
import requestUtil from '@/util/request'
import axios from 'axios';
import { queryFilters } from "@/util/util";




// 获取学生列表
export function getStuList(data) {
    return  requestUtil.post("stu_teacher/search_stu", data)
}


// 获取学生列表
export function getStuItem({ ...data }) {
    let r
    if(data != {}){
        r = queryFilters(data)
    }else{
        r = ''
    }
    return  requestUtil.get(`stu_teacher/action_stu${r}`)
}



// 删除学生
export function delStuList(ids) {
    return requestUtil.del("stu_teacher/action_stu", ids)
}

// 添加/ 修改学生
export function saveStu(data) {
    return requestUtil.post("stu_teacher/save_stu", data)
}


// ================================================================================================

// 获取老师列表
export function getTeaList({ ...data }) {
    return  requestUtil.post("stu_teacher/search_tea", data)
}

// 获取单个老师
export function getTeaItem({...data}) {
    let r
    if(data != {}){
        r = queryFilters(data)
    }else{
        r = ''
    }
    return  requestUtil.get(`stu_teacher/action_tea${r}`)
}


// 删除老师
export function delTeaList(ids) {
    return requestUtil.del("stu_teacher/action_tea", ids)
}

// 添加/ 修改老师
export function saveTea(data) {
    return requestUtil.post("stu_teacher/save_tea", data)
}


// =============================================================
// 学生选择导师
export function handleSelectTea(data) {
    return requestUtil.post("stu_teacher/save_select_tea", data)
}


// 学生退选导师
export function handleDelSelectTea(data) {
    return requestUtil.post("stu_teacher/del_select_tea", data)
}

// 导师退选学生
export function handleDelSelectStu(data) {
    return requestUtil.post("stu_teacher/del_select_stu", data)
}

// 获取学生选择的导师
export function getSelectTea(data) {
    let r
    if(data != {}){
        r = queryFilters(data)
    }else{
        r = ''
    }
    return requestUtil.get(`stu_teacher/get_select_tea${r}`)
}

// 获取某导师的学生
export function getSelectStu(data) {
    let r
    if(data != {}){
        r = queryFilters(data)
    }else{
        r = ''
    }
    return requestUtil.get(`stu_teacher/get_select_stu${r}`)
}


// 全部双选结果
export function getSelectAll({ ...data }) {
    return  requestUtil.post("stu_teacher/select_res", data)
}



// 导出全部双选结果
export function exportSelectAll({ ...data }) {
    return axios.get('http://127.0.0.1:8000/stu_teacher/export', {
      responseType: 'blob'
    });
}




